﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.LeaveCommand;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.LeaveHandler
{
    public class LeaveCreateCommandHandler:IRequestHandler<LeaveCreateCommand,int>
    {
        /// <summary>
        /// 请假服务层
        /// </summary>
        ILeaveService lSer;
        public LeaveCreateCommandHandler(ILeaveService lSer)
        {
            this.lSer = lSer;
        }

        public async Task<int> Handle(LeaveCreateCommand request, CancellationToken cancellationToken)
        {
            return await lSer.AddLeave(new Entity.Leave() { Lid = request.Lid , Uid = request.Uid, UName = request.UName, department = request.department, Ltype = request.Ltype, KAddtime = request.KAddtime, JAddtime = request.JAddtime, GZTime = request.GZTime, BdTime = request.BdTime, LSdata = request.LSdata, BTName = request.BTName, AddTime = request.AddTime, LSdate = request.LSdate, NotSdate= request.NotSdate, IsDeleted = request.IsDeleted });
        }
    }
}
